<%@ page import="soccer.stats.PlayerHistory" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'playerHistory.label', default: 'PlayerHistory')}"/>
    <title><g:message code="default.edit.label" args="[entityName]"/></title>
</head>

<body>
<div class="nav">
    <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a>
    </span>
    <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label"
                                                                           args="[entityName]"/></g:link></span>
    <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label"
                                                                               args="[entityName]"/></g:link></span>
</div>

<div class="body">
    <h1><g:message code="default.edit.label" args="[entityName]"/></h1>
    <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${playerHistoryInstance}">
        <div class="errors">
            <g:renderErrors bean="${playerHistoryInstance}" as="list"/>
        </div>
    </g:hasErrors>
    <g:form method="post">
        <g:hiddenField name="id" value="${playerHistoryInstance?.id}"/>
        <g:hiddenField name="version" value="${playerHistoryInstance?.version}"/>
        <div class="dialog">
            <table>
                <tbody>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="transferInDate"><g:message code="playerHistory.transferInDate.label"
                                                               default="Transfer In Date"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: playerHistoryInstance, field: 'transferInDate', 'errors')}">
                        <g:datePicker name="transferInDate" precision="day"
                                      value="${playerHistoryInstance?.transferInDate}" default="none"
                                      noSelection="['': '']"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="transferOutDate"><g:message code="playerHistory.transferOutDate.label"
                                                                default="Transfer Out Date"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: playerHistoryInstance, field: 'transferOutDate', 'errors')}">
                        <g:datePicker name="transferOutDate" precision="day"
                                      value="${playerHistoryInstance?.transferOutDate}" default="none"
                                      noSelection="['': '']"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="currentTeam"><g:message code="playerHistory.currentTeam.label"
                                                            default="Current Team"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: playerHistoryInstance, field: 'currentTeam', 'errors')}">
                        <g:checkBox name="currentTeam" value="${playerHistoryInstance?.currentTeam}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="mainPosition"><g:message code="playerHistory.mainPosition.label"
                                                             default="Main Position"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: playerHistoryInstance, field: 'mainPosition', 'errors')}">
                        <g:textField name="mainPosition" value="${playerHistoryInstance?.mainPosition}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="squadNumber"><g:message code="playerHistory.squadNumber.label"
                                                            default="Squad Number"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: playerHistoryInstance, field: 'squadNumber', 'errors')}">
                        <g:textField name="squadNumber"
                                     value="${fieldValue(bean: playerHistoryInstance, field: 'squadNumber')}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="player"><g:message code="playerHistory.player.label" default="Player"/></label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean: playerHistoryInstance, field: 'player', 'errors')}">
                        <g:select name="player.id" from="${soccer.stats.Person.list()}" optionKey="id"
                                  value="${playerHistoryInstance?.player?.id}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="team"><g:message code="playerHistory.team.label" default="Team"/></label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean: playerHistoryInstance, field: 'team', 'errors')}">
                        <g:select name="team.id" from="${soccer.stats.Team.list()}" optionKey="id"
                                  value="${playerHistoryInstance?.team?.id}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="personRole"><g:message code="playerHistory.personRole.label"
                                                           default="Person Role"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: playerHistoryInstance, field: 'personRole', 'errors')}">
                        <g:select name="personRole" from="${playerHistoryInstance.constraints.personRole.inList}"
                                  value="${playerHistoryInstance?.personRole}"
                                  valueMessagePrefix="playerHistory.personRole"/>
                    </td>
                </tr>

                </tbody>
            </table>
        </div>

        <div class="buttons">
            <span class="button"><g:actionSubmit class="save" action="update"
                                                 value="${message(code: 'default.button.update.label', default: 'Update')}"/></span>
            <span class="button"><g:actionSubmit class="delete" action="delete"
                                                 value="${message(code: 'default.button.delete.label', default: 'Delete')}"
                                                 onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');"/></span>
        </div>
    </g:form>
</div>
</body>
</html>
